
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../utils/color_util/color_util.dart';
import '../../utils/style_util/style_util.dart';
import '../text_widget/text_widget.dart';

/// @className : alert_dialog_widget
/// @date 2022/07/30 21:20 
/// @author : xiaohai
/// @description : 警告对话框

class AlertsDialogWidget extends StatefulWidget {

  AlertsDialogWidget({Key? key, required this.titleStr, this.canceEvent,this.sureEvent})
      : super(key: key);
  /// 标题
  String? titleStr;
  /// 取消点击事件
  Function()? canceEvent;
  /// 确认点击事件
  Function()? sureEvent;

  @override
  _AlertsDialogWidgetState createState() => _AlertsDialogWidgetState();
}

class _AlertsDialogWidgetState extends State<AlertsDialogWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 590.w,
      height: 336.w,
      padding: EdgeInsets.symmetric(horizontal: 64.w),
      decoration: BoxDecoration(
        color: ColorsUtil.hexColor(0xFFFFFF),
        borderRadius: BorderRadius.circular(32.w),
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Container(
            margin: EdgeInsets.only(top: 64.w),
              child:textWidget("${widget.titleStr}", TS_272133_32_W4,maxLines: 2),
          ),
          // SizedBox(height: 64.w),
          Container(
            margin: EdgeInsets.only(bottom: 64.w),
            child:  Row(
              mainAxisAlignment:
              MainAxisAlignment.spaceBetween,
              children: [
                GestureDetector(
                  onTap: () {
                    //取消
                    widget.canceEvent!();
                    Navigator.pop(context);
                  },
                  child: Container(
                    height: 96.w,
                    width: 208.w,
                    alignment: Alignment.center,
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.all(
                            Radius.circular(48.w)),
                        color:
                        ColorsUtil.hexColor(0xF4F2FC)),
                        child:textWidget("取消", TS_3E3752_36_W4),

                    // child: textWidget(
                    //     '${S.of(context).cancel}',
                    //     36.sp,
                    //     FontWeight.w400,
                    //     ColorsUtil.hexColor(0x3E3752)
                  ),
                ),
                GestureDetector(
                  onTap: () {
                    //确定发送
                    widget.sureEvent!();
                    Navigator.pop(context);

                  },
                  child: Container(
                    height: 96.w,
                    width: 208.w,
                    alignment: Alignment.center,
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.all(
                            Radius.circular(48.w)),
                        color: ColorsUtil.hexColor(0x722ED1)
                    ),
                    child:textWidget("确定", TS_FFFFFF_36_W4),
                  ),
                )
              ],
            ),
          )
          //SizedBox(height: 48.w)
        ],
      ),
    );
  }
}